package net.funtip.ormgenerator.model;

public class OrderBy {
	
	public enum OrderDirection {asc, desc}
	
	private Finder finder;
	private OrderDirection direction;
	private Attribute attribute;
	
	public OrderBy(Finder finder, Attribute attr) {
		this.finder = finder;
		this.attribute = attr;
		this.direction = OrderDirection.asc;
		finder.addOrderBy(this);
	}
	
	public Finder getFinder() {
		return finder;
	}
	
	public void setFinder(Finder finder) {
		this.finder = finder;
	}
	
	public OrderDirection getDirection() {
		return direction;
	}
	
	public void setDirection(OrderDirection direction) {
		this.direction = direction;
	}
	
	public Attribute getAttribute() {
		return attribute;
	}
	
	public void setAttribute(Attribute attribute) {
		this.attribute = attribute;
	}
	
	public boolean isDescending() {
		return direction.equals(OrderDirection.desc);
	}
	

}
